package com.ctrl.riveradministrator.mvp.view.activity.trace.daemon;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;

import com.ctrl.riveradministrator.R;


/**
 * 1像素透明界面，保活使用
 */
public class MicroPixelActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_micro_pixel);

        Log.d("MicroPixelActivity", "onCreate");

        // Activity是依附在Window上的
        Window window = getWindow();
        // 把这个一个像素点设置在左上角。
        window.setGravity(Gravity.LEFT | Gravity.TOP);
        // 设置一个像素
        WindowManager.LayoutParams params = new WindowManager.LayoutParams();
        params.width = 1;
        params.height = 1;
        window.setAttributes(params);

        DaemonManager.getInstance(this).setKeepLiveActivity(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.d("MicroPixelActivity", "onDestroy");
    }
}
